<?php


namespace App\Services;


use Mockery;
use Mockery\LegacyMockInterface;
use Mockery\MockInterface;

class BaseServices
{
    protected static array $instance = [];

    /**
     * @return static
     */
    public static function getInstance()
    {
        if ((static::$instance[static::class] ?? null) instanceof static) {
            return static::$instance[static::class];
        }
        return static::$instance[static::class] = new static();
    }

    /**
     * @return LegacyMockInterface|MockInterface
     */
    public static function mockInstance()
    {
        return static::$instance[static::class] = Mockery::mock(static::class)
            ->makePartial()
            ->shouldAllowMockingProtectedMethods();
    }

    public function __construct()
    {
    }

    private function __clone()
    {
    }


}
